<!--  -->
<template>
  <div>
    <div class="notice_t" v-if="seoSiteStatus === 1">
      <i class="el-icon-info"></i>
      <div class="nt_p">
        <p>已设置统一TDK，当前seo设置不生效。<el-button @click="linkTdkSet" type="text" size="medium">【前往修改】</el-button></p>
      </div>
    </div>
    <div class="product-item-form-seo">
      <el-form-item
        label="Title 标题"
        style="min-width:180px;max-width:680px;"
      >
        <el-input
          v-model="seo.title"
          size="medium"
          placeholder="输入不超过200个字符"
          maxlength="200"
        ></el-input>
      </el-form-item>

      <el-form-item
        label="Keywords 关键字"
        style="min-width:180px;max-width:680px;"
      >
        <el-input
          v-model="seo.keywords"
          size="medium"
          placeholder="输入不超过250个字符"
          maxlength="250"
        ></el-input>
      </el-form-item>

      <el-form-item
        label="Description 描述"
        style="min-width:180px;max-width:680px;"
      >
        <el-input
          v-model="seo.description"
          type="textarea"
          size="medium"
          maxlength="65535"
          :rows="3"
        ></el-input>
      </el-form-item>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    system: {
      type: Object
    },
    seo: {
      type: Object
    }
  },
  created () {
    let siteSeo = parseInt(this.sConfig.siteSeo)
    if (!isNaN(siteSeo) && siteSeo >= 0) {
      this.$post('/seo/seosite', { site_seo: siteSeo }).then(response => {
        if (response && response.id) {
          this.seoSiteStatus = response.status
        }
      })
    }
  },
  data () {
    return {
      sConfig: {
        siteSeo: this.$store.state && this.$store.state.site && this.$store.state.site.config ? '' + this.$store.state.site.config.siteSeo : ''
      },
      // TKD状态
      seoSiteStatus: 0
    }
  },
  methods: {
    linkTdkSet () {
      this.$store.dispatch('menuChange', {index: '2-2', isAlwaysPush: true})
    }
  }
}

</script>

<style scoped>
.notice_t {
  position: relative;
  padding-left: 20px;
  margin-top: -10px;
  margin-bottom: 20px;
  color: #666;
}
.notice_t i {
  position: absolute;
  color:#E6A23C;
  left: 0;
  top: 11px;
}
</style>
